package com.rongshu.view.userInfo.presenter;

import android.content.Context;

import com.rongshu.api.RetorfitService;
import com.rongshu.view.base.mvp.BasePresenter;
import com.rongshu.view.userInfo.entity.TodayRecord;
import com.rongshu.view.userInfo.iview.BrowsingView;

import rx.Subscriber;

public class BrowsingPresenter extends BasePresenter<BrowsingView> {

    public BrowsingPresenter(Context context) {
        super(context);
    }

    /**
     * 我的浏览记录
     */
    public void getMyBrowsingHistory(int user_id, int type, int page, int pagesize, String sign) {
        RetorfitService.getMyBrowsingHistory(user_id, type, page, pagesize, sign)
                .subscribe(new Subscriber<TodayRecord>() {
                    @Override
                    public void onCompleted() {

                    }

                    @Override
                    public void onError(Throwable e) {

                    }

                    @Override
                    public void onNext(TodayRecord todayRecord) {
                        if (getView() != null) {
                            getView().onMyBrowsingHistory(todayRecord);
                        }
                    }
                });
    }
}
